import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;


public class DateEx {
	public static void main(String[] args) {
        
		/*
		 * create custom date
		 */
		
		// case 1
		Date now = new Date();
		System.out.println("date: " + now.toString());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
        sdf.format( now );
        //System.out.println("Date: " + sdf.format( now ));
        
//        case 2
        String newDateStr = "21-2-2008";
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
        Date date;
        try{
        	date = dateFormat.parse(newDateStr);
        	System.out.println("Date: " + date.toString());
        }catch(Exception exception){
        	// TODO
        }
        

//        case 3
        Calendar xmas = new GregorianCalendar(1998, Calendar.DECEMBER, 25);
	    Date date1 = xmas.getTime();
	    
	    //System.out.println("Date: " + date1.toString());
        
	}
}
